package cn.net.xinyi.xs.dao.hr.ibatis;

import java.util.List;
import java.util.Map;

import cn.net.xinyi.xs.dao.hr.OrganDao;
import cn.net.xinyi.xs.dao.ibatis.BaseDaoiBatis;
import cn.net.xinyi.xs.model.hr.Organization;

public class OrganDaoiBatis extends BaseDaoiBatis implements OrganDao {
	
	public Organization getOrgan(Long id) {
		return (Organization) getSqlMapClientTemplate().queryForObject(
				"getOrganization", id);
	}

	public Organization getOrganWithChild(Long id) {
		return (Organization) getSqlMapClientTemplate().queryForObject(
				"getOrganWithChild", id);
	}

	@SuppressWarnings("unchecked")
	public List<Organization> getOrgans(int skipResults, int maxResults) {
		return (List<Organization>) getSqlMapClientTemplate().queryForList(
				"getOrgans", skipResults, maxResults);
	}

	public int getOrganCount() {
		return ((Integer) getSqlMapClientTemplate().queryForObject(
				"getOrganCount")).intValue();
	}

	@SuppressWarnings("unchecked")
	public List<Organization> getOrganChildren(Long id) {
		return (List<Organization>) getSqlMapClientTemplate().queryForList(
				"getOrganChildren", id);
	}

	@SuppressWarnings("unchecked")
	public List<Organization> getOrganRecursionChild(Long id) {
		return (List<Organization>) getSqlMapClientTemplate().queryForList(
				"getOrganRecursionChild", id);
	}

	@SuppressWarnings("unchecked")
	public List<Organization> getAllBranchOrgans(Map map) {
		return (List<Organization>) getSqlMapClientTemplate().queryForList(
				"getAllBranchOrgans", map);
	}

	@SuppressWarnings("unchecked")
	public List<Organization> getBranchOrganByOrgCode(Map map) {
		return (List<Organization>) getSqlMapClientTemplate().queryForList(
				"getBranchOrganByOrgCode", map);
	}

	@SuppressWarnings("unchecked")
	public List<Organization> getBranchOrgans(Map map, int skipResults,
			int maxResults) {
		return (List<Organization>) getSqlMapClientTemplate().queryForList(
				"getBranchOrganByOrgCode", map, skipResults, maxResults);
	}

}
